home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DJLSR106.ARJ / EXP.S < prev    next >
Text File  |  1991-08-19  |  2KB  |  93 lines

  1. /* This is file EXP.S */
  2. /*
  3. ** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
  4. **
  5. ** Modified O.ROBERT 24, Avenue de Verdun 92170 VANVES, FRANCE
  6. **
  7. ** E-mail: roberto@germinal.ibp.fr
  8. **
  9. ** This file is distributed under the terms listed in the document
  10. ** "copying.dj", available from DJ Delorie at the address above.
  11. ** A copy of "copying.dj" should accompany this file; if not, a copy
  12. ** should be available from where this file was obtained.  This file
  13. ** may not be distributed without a verbatim copy of "copying.dj".
  14. **
  15. ** This file is distributed WITHOUT ANY WARRANTY; without even the implied
  16. ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  17. **
  18. ** or    03-Apr-1991    corrected bug about argument zero to pow
  19. **            fyl2x didn't like it
  20. */
  21.  
  22. /* History:15,24 */
  23.     .data
  24. LCW1:
  25.     .word    0
  26. LCW2:
  27.     .word    0
  28.  
  29.     .text
  30.  
  31. LC0:
  32.     .double    0d1.0e+00
  33.  
  34.     .globl    _pow2
  35. _pow2:
  36.     fldl    4(%esp)
  37. Lpow2:
  38.     fstcww    LCW1
  39.     fstcww    LCW2
  40.     fwait
  41.     andw    $0xf3ff,LCW2
  42.     orw    $0x0400,LCW2
  43.     fldcww    LCW2
  44.     fldl    %st(0)
  45.     frndint
  46.     fldcww    LCW1
  47.     fxch    %st(1)
  48.     fsub    %st(1),%st
  49.     f2xm1
  50.     faddl    LC0
  51.     fscale
  52.     fstp    %st(1)
  53.     ret
  54.  
  55.     .globl    _exp
  56. _exp:
  57.     fldl    4(%esp)
  58.     fldl2e
  59.     fmulp
  60.     jmp    Lpow2
  61.  
  62.     .globl    _pow10
  63. _pow10:
  64.     fldl    4(%esp)
  65.     fldl2t
  66.     fmulp
  67.     jmp    Lpow2
  68.  
  69.     .globl    _pow
  70. _pow:
  71.     fldl    4(%esp)
  72.     ftst
  73.     fnstsww %ax
  74.     sahf
  75.     je    zero1
  76.     fldl    12(%esp)
  77.     ftst
  78.     fnstsww %ax
  79.     sahf
  80.     je    zero2
  81.     fxch    %st(1)
  82.     fyl2x
  83.     jmp    Lpow2
  84. zero1:
  85.     fstpl    4(%esp)
  86.     fldzl
  87.     ret
  88. zero2:
  89.     fstpl    4(%esp)
  90.     fstpl    4(%esp)
  91.     fld1l
  92.     ret
  93.